<template>
  <div class="mod-marketing-coupon">
    <div class="search-bar">
      <el-form :inline="true" class="search-form" ref="searchForm" :model="searchForm" size="small" >
        <div class="input-row">
          <el-form-item prop="payeeName" label="分润人名称"  class="search-form-item">
            <el-input v-model="searchForm.payeeName"  />
          </el-form-item>
          <div class="default-btn primary-btn marginBottom" @click="searchChange()">{{$t('product.search')}}</div>
          <div class="default-btn" @click="resetSearchForm('searchForm')">{{$t('product.reset')}}</div>
        </div>
      </el-form>
    </div>
    <div class="main-container">
      <div class="table-con coupon-table">
        <el-table
          ref="couponListTable"
          :data="dataList"
          header-cell-class-name="table-header"
          row-class-name="table-row-low"
          style="width: 100%">

          <el-table-column
            prop="payNo"
            label="分润号"
            >
          </el-table-column>
          <el-table-column
            prop="amount"
            label="分润金额"
            >
          </el-table-column>
          <el-table-column
            prop="payerBizUserNo"
            label="付款方用户编号"
            >
          </el-table-column>
          <el-table-column
            prop="payerName"
            label="付款人名称"
          >
          </el-table-column>
          <el-table-column
            prop="payeeBizUserNo"
            label="收款方用户编号"
          >
          </el-table-column>
          <el-table-column
            prop="payeeName"
            label="收款人名称"
          >
          </el-table-column>
          <el-table-column
            prop="payStatus"
            label="状态"
          >
            <template slot-scope="scope">
              <span v-if="scope.row.payStatus == 3" class="tag-text">分润成功</span>
            </template>
          </el-table-column>
          <el-table-column
            prop="createTime"
            label="分润时间"
            >
          </el-table-column>
        </el-table>
      </div>
      <el-pagination
        v-if="dataList.length"
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        :current-page="page.current"
        :page-sizes="[10, 20, 50, 100]"
        :page-size="page.size"
        layout="total, sizes, prev, pager, next, jumper"
        :total="page.total">
      </el-pagination>
    </div>
  </div>
</template>

<script>
  export default {
    components: {
    /*   Detail,
      Reg */
    },
    data () {
      return {
        reason: '',
        auditData: null,
        dataForm: {
          name: '',
          code: '',
          status: null
        },
        dataList: [],
        dataListLoading: false,
        page: {
          total: 0, // 总页数
          current: 1, // 当前页数
          size: 10 // 每页显示多少条
        },
        searchForm: {
          payeeName: '',
          payStatus:3,
          transType:3,
          profitType:3,
          platformType:1
        }
      }
    },
    created () {
      this.getDataList()
    },
    methods: {
      // 获取数据列表
      getDataList () {
        this.dataListLoading = true
        this.$http({
          url: this.$http.adornUrl('/platform/sandProfit/getProfitPage'),
          method: 'get',
          params: this.$http.adornParams(
            Object.assign(
              this.page,
              this.searchForm
            ), false
          )
        }).then(({ data }) => {
          this.dataList = data.records
          this.page.total = data.total
          this.dataListLoading = false
        })
      },
      // 条件查询
      searchChange () {
        this.page.total = 0
        this.page.current = 1
        this.getDataList()
      },
      // 刷新回调用
      refreshChange () {
        this.page.total = 0
        this.page.current = 1
        this.page.size = 10
        this.getDataList(this.page)
      },
      /**
       * 重置表单
       * @param {String} formName 表单名称
       */
      resetSearchForm (formName) {
        this.$refs[formName].resetFields()
        this.refreshChange()
      },
      handleSizeChange (val) {
        this.page.size = val
        this.getDataList()
      },
      handleCurrentChange (val) {
        this.page.current = val
        this.getDataList()
      },

    }
  }
</script>
<style lang="scss" scoped>
  .marginBottom{margin-bottom:20px}
</style>
